<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>demo</title>
    <script src="../node_modules/vue/dist/vue.js" type="text/javascript" charset="utf-8"></script>

    <style>
        .active {
            width: 200px;
            height: 200px;
            background: bisque;
        }
    </style>

</head>

<body>

    <div id="app">
        <div class="page" :class="{active:isTrue}">
            {{msg}}
            <p>放置字符串</p>
        </div>
        <hr>
        <div class="page" :class="styleObj">通过对象</div>
        <hr>
        <div class="page" :class="styleArr">2直接放置数组</div>
        <hr>
        <div class="page" :class="styleArrObj">对象数组混合</div>
    </div>

    <script type="text/javascript">
        // console.log(Vue)
        let app = new Vue({
            el: "#app",
            data: {
                msg: "hello vue",
                isTrue:true,
                styleObj:{active:true,"col-lg-6":true},
                styleArr:["active","col-xs-12","red-bg"],
                styleArrObj:[{active:true},"col-xs-12","red-bg"]
            },
            watch: {
                msg: function (newVal, oldVal) {
                    console.log('----msg change');
                    console.log(newVal)
                    console.log(oldVal)

                }
            }

        })
    </script>
</body>

</html>